package com.desay.pangoo.itmt.entity;

import java.io.Serializable;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import lombok.Data;

/**
 * 技术文档（新闻）
 * 
 * @author uidq1163
 */
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "tech_news_feedback")
@Data
public class TechNewsFeedbackEntity extends BaseEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", columnDefinition = "bigint COMMENT '主键'")
	private Long id;

	@Column(name = "remark", columnDefinition = "text COMMENT '评论'")
	private String remark;

	@Column(name = "is_approval", columnDefinition = "bit COMMENT '是否赞同技术'")
	private Boolean isApproval;

	@OneToOne(fetch = FetchType.LAZY, cascade = { CascadeType.REFRESH })
	@JoinColumn(name = "parent_id")
	private TechNewsEntity parent;

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		TechNewsFeedbackEntity other = (TechNewsFeedbackEntity) obj;
		if (id == null) {
			if (other.id != null) {
				return false;
			}
		} else if (!id.equals(other.id)) {
			return false;
		}
		return true;
	}
}
